package com.huarui.part.dao.impl;

import java.util.List;
import java.util.Map;

import org.ewaf.framework.dao.impl.BaseDaoImpl;

import com.huarui.part.dao.IUnitDao;
import com.huarui.part.model.MeasurementUnit;

public class UnitDao extends BaseDaoImpl implements IUnitDao {

	@SuppressWarnings("unchecked")
	@Override
	public List<MeasurementUnit> getAllUnits() {

		return this.getSqlMapClientTemplate().queryForList(
				namespace + ".getAll");
	}

	@Override
	public MeasurementUnit getByName(String name) {

		return (MeasurementUnit) this.getSqlMapClientTemplate().queryForObject(
				namespace + ".getUtilByName", name);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<MeasurementUnit> getAllUnitsExt() {
		return this.getSqlMapClientTemplate().queryForList(
				namespace + ".getAllExt");
	}

	@Override
	@SuppressWarnings("unchecked")
	public List<Map<String, Object>> getMeasurementUnitListByComplex(
			Map<String, Object> paramsMap) {
		return this.getSqlMapClientTemplate().queryForList(super.namespace + ".getMeasurementUnitListByComplex", paramsMap);
	}

	@Override
	public Integer getMeasurementUnitListCountByComplex(
			Map<String, Object> paramsMap) {
		return (Integer) this.getSqlMapClientTemplate().queryForObject(super.namespace + ".getMeasurementUnitListCountByComplex", paramsMap);
	}

}
